<?php
require_once '../sever/json.php';
require_once '../sever/dbhelper.php';

if(empty($_REQUEST['id'])){
    echo '<script>alert("缺少id")</script>';
    return;
}

$id=$_REQUEST['id'];
$pdo=DB::getInstance()->connect();


$stmt=$pdo->query("SELECT news.*,news_type.`name` FROM `news` LEFT JOIN news_type ON news.type_id=news_type.id  where news.id=$id");
$data = $stmt->fetch();

Responce::json('200','succes',$data);